using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class REDQuizMap : EntityTypeConfiguration<REDQuiz>
    {
        public REDQuizMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.OpenId)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("REDQuiz");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.OpenId).HasColumnName("OpenId");
            this.Property(t => t.QuizId).HasColumnName("QuizId");
            this.Property(t => t.IsCorrect).HasColumnName("IsCorrect");
            this.Property(t => t.AnswerTime).HasColumnName("AnswerTime");
        }
    }
}
